package net.scala.chapter1.test

import org.junit.Assert._
import org.junit.{Before, Test}
import org.scalatest.junit.AssertionsForJUnit

/**
 * @author chenyy2@corp.21cn.com
 */
class TestScala extends AssertionsForJUnit {

  var name: StringBuilder = _

  /*------------
   |注意命名规法
   ------------*/

  @Before def initialize() {
    name = new StringBuilder("Barudisshu")
  }

  @Test def upperCase() {
    assertEquals("是否包含大写字母？", true, name.exists(_.isUpper))
  }

  @Test def countNum() {
    val src = scala.io.Source.fromFile(getClass.getClassLoader.getResource("").getPath + "count.txt")
    val num = src.getLines().map(x => 1).sum
    println(f"文本行数为：$num 行")
  }
}
